﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.2.17    凭证历史信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_FIN_VOUCHERHIS: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_FIN_VOUCHERHIS()
		{}
		#region Model
		private long _id;
		private string _vouwordnum;
		private string _vouword;
		private int _vounum;
		private Nullable<DateTime> _busdate;
		private string _accperiod;
		private int _annexnum;
		private string _custname;
		private long _custid;
		private string _empname;
		private long _empid;
		private decimal _debitamt;
		private decimal _lenderamt;
		private string _createby;
		private Nullable<DateTime> _createdate;
		private string _modifyby;
		private Nullable<DateTime> _modifydate;
		private int _voutype;
		private int _auditstatus;
		private string _auditby;
		private Nullable<DateTime> _auditdate;
		private int _deleteflag;
		private string _deleteby;
		private Nullable<DateTime> _deletedate;
		/// <summary>
		/// 记录ID
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 凭证字号
		/// </summary>
		[DataMember]
		public string VOUWORDNUM
		{
			get{return _vouwordnum;}
			set{
				if ( _vouwordnum!= value)
				{
					 _vouwordnum = value;
					OnPropertyChanged("VOUWORDNUM");
				}
			}
		}
		/// <summary>
		/// 凭证字
		/// </summary>
		[DataMember]
		public string VOUWORD
		{
			get{return _vouword;}
			set{
				if ( _vouword!= value)
				{
					 _vouword = value;
					OnPropertyChanged("VOUWORD");
				}
			}
		}
		/// <summary>
		/// 凭证号
		/// </summary>
		[DataMember]
		public int VOUNUM
		{
			get{return _vounum;}
			set{
				if ( _vounum!= value)
				{
					 _vounum = value;
					OnPropertyChanged("VOUNUM");
				}
			}
		}
		/// <summary>
		/// 业务日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> BUSDATE
		{
			get{return _busdate;}
			set{
				if ( _busdate!= value)
				{
					 _busdate = value;
					OnPropertyChanged("BUSDATE");
				}
			}
		}
		/// <summary>
		/// 会计期间
		/// </summary>
		[DataMember]
		public string ACCPERIOD
		{
			get{return _accperiod;}
			set{
				if ( _accperiod!= value)
				{
					 _accperiod = value;
					OnPropertyChanged("ACCPERIOD");
				}
			}
		}
		/// <summary>
		/// 附单据X张
		/// </summary>
		[DataMember]
		public int ANNEXNUM
		{
			get{return _annexnum;}
			set{
				if ( _annexnum!= value)
				{
					 _annexnum = value;
					OnPropertyChanged("ANNEXNUM");
				}
			}
		}
		/// <summary>
		/// 核算客户
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 核算客户记录ID
		/// </summary>
		[DataMember]
		public long CUSTID
		{
			get{return _custid;}
			set{
				if ( _custid!= value)
				{
					 _custid = value;
					OnPropertyChanged("CUSTID");
				}
			}
		}
		/// <summary>
		/// 核算员工
		/// </summary>
		[DataMember]
		public string EMPNAME
		{
			get{return _empname;}
			set{
				if ( _empname!= value)
				{
					 _empname = value;
					OnPropertyChanged("EMPNAME");
				}
			}
		}
		/// <summary>
		/// 核算员工记录ID
		/// </summary>
		[DataMember]
		public long EMPID
		{
			get{return _empid;}
			set{
				if ( _empid!= value)
				{
					 _empid = value;
					OnPropertyChanged("EMPID");
				}
			}
		}
		/// <summary>
		/// 借方金额合计
		/// </summary>
		[DataMember]
		public decimal DEBITAMT
		{
			get{return _debitamt;}
			set{
				if ( _debitamt!= value)
				{
					 _debitamt = value;
					OnPropertyChanged("DEBITAMT");
				}
			}
		}
		/// <summary>
		/// 贷方金额合计
		/// </summary>
		[DataMember]
		public decimal LENDERAMT
		{
			get{return _lenderamt;}
			set{
				if ( _lenderamt!= value)
				{
					 _lenderamt = value;
					OnPropertyChanged("LENDERAMT");
				}
			}
		}
		/// <summary>
		/// 制单人
		/// </summary>
		[DataMember]
		public string CREATEBY
		{
			get{return _createby;}
			set{
				if ( _createby!= value)
				{
					 _createby = value;
					OnPropertyChanged("CREATEBY");
				}
			}
		}
		/// <summary>
		/// 制单日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATEDATE
		{
			get{return _createdate;}
			set{
				if ( _createdate!= value)
				{
					 _createdate = value;
					OnPropertyChanged("CREATEDATE");
				}
			}
		}
		/// <summary>
		/// 修改人
		/// </summary>
		[DataMember]
		public string MODIFYBY
		{
			get{return _modifyby;}
			set{
				if ( _modifyby!= value)
				{
					 _modifyby = value;
					OnPropertyChanged("MODIFYBY");
				}
			}
		}
		/// <summary>
		/// 修改时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> MODIFYDATE
		{
			get{return _modifydate;}
			set{
				if ( _modifydate!= value)
				{
					 _modifydate = value;
					OnPropertyChanged("MODIFYDATE");
				}
			}
		}
		/// <summary>
		/// 凭证类别1普通凭证，2核算凭证，3结转凭证
		/// </summary>
		[DataMember]
		public int VOUTYPE
		{
			get{return _voutype;}
			set{
				if ( _voutype!= value)
				{
					 _voutype = value;
					OnPropertyChanged("VOUTYPE");
				}
			}
		}
		/// <summary>
		/// 审批状态0否，1是
		/// </summary>
		[DataMember]
		public int AUDITSTATUS
		{
			get{return _auditstatus;}
			set{
				if ( _auditstatus!= value)
				{
					 _auditstatus = value;
					OnPropertyChanged("AUDITSTATUS");
				}
			}
		}
		/// <summary>
		/// 审批人
		/// </summary>
		[DataMember]
		public string AUDITBY
		{
			get{return _auditby;}
			set{
				if ( _auditby!= value)
				{
					 _auditby = value;
					OnPropertyChanged("AUDITBY");
				}
			}
		}
		/// <summary>
		/// 审批时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> AUDITDATE
		{
			get{return _auditdate;}
			set{
				if ( _auditdate!= value)
				{
					 _auditdate = value;
					OnPropertyChanged("AUDITDATE");
				}
			}
		}
		/// <summary>
		/// 删除状态0否，1是
		/// </summary>
		[DataMember]
		public int DELETEFLAG
		{
			get{return _deleteflag;}
			set{
				if ( _deleteflag!= value)
				{
					 _deleteflag = value;
					OnPropertyChanged("DELETEFLAG");
				}
			}
		}
		/// <summary>
		/// 删除人
		/// </summary>
		[DataMember]
		public string DELETEBY
		{
			get{return _deleteby;}
			set{
				if ( _deleteby!= value)
				{
					 _deleteby = value;
					OnPropertyChanged("DELETEBY");
				}
			}
		}
		/// <summary>
		/// 删除时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> DELETEDATE
		{
			get{return _deletedate;}
			set{
				if ( _deletedate!= value)
				{
					 _deletedate = value;
					OnPropertyChanged("DELETEDATE");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

